<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>each</title>
    <meta charset="UTF-8">
    <script type="text/javascript" src="../../static/template.js"></script>
</head>
<body>
<div id="app"></div>
<script type="text/html" id="test">
  {{if isAdmin}}
    <h1>{{title}}</h1>
  {{each list as value index}}
    <ul>
        <li>{{index + 1}} : {{value}}</li>
    </ul>
  {{/each}}
    {{/if}}
</script>
<script type="text/javascript">
    var data = {
        isAdmin:true,
        title:'球类运动',
        list:['足球','篮球','排球','棒球','网球','羽毛球','乒乓球']
    }
    var html = template('test',data);
    document.getElementById('app').innerHTML = html;
</script>
</body>
</html>